﻿package main {
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.display.Graphics;
	import flash.text.TextField; 
	import main.*;
	
	dynamic public  class obj extends MovieClip{
		
	var num  : Number;	
	var power  : Number;
	var player  : Number;
	var col  : Number;
	var txt  : TextField;
	var sila : Number;
	var masid  : Number;	
	var Rad : Number=20;
	
	public function obj (){
	  //       doubleClickEnabled=true;
			 graphics.lineStyle(1,0x000000);
		     graphics.beginFill(0xFF0000);
		     graphics.drawCircle( 0,0,Rad );
			 addEventListener(MouseEvent.MOUSE_DOWN, obrdown);
	         addEventListener(MouseEvent.MOUSE_UP, obrup);
	 
              txt= new TextField();
			  txt.textColor=0x999999;
			  txt.x=-14;
			  txt.y=-9;
			  
		      txt.text=""+GLOB.GL2;
			  txt.width=20;
			  txt.height=20;
			  
			
			  txt.selectable=false;
			  
			//  trace("numtxt"+GLOB.GL2);
		      addChild(txt);	
			  	 }
	 
	 public function otm():void
	 {       
	         graphics.clear();
	         graphics.lineStyle(1,0x000000);
		     graphics.beginFill(col);
		     graphics.drawCircle( 0,0,Rad );
			// trace("otmena "+num);
	 }
	 
	  public function ris():void
	 {       
	        // col=0xFFFFFF;
	         graphics.clear();
	         graphics.lineStyle(1,0x000000);
		     graphics.beginFill(col);
		     graphics.drawCircle( 0,0,Rad );
			// trace("off "+num);
	 }
	 
	 
	 private function obrdown(evt:MouseEvent):void
	 { 
	  //    name=name+"L";
	//  trace("objclisck num="+num+" x= "+x+" GL1= "+GLOB.GL1+' GLOB.PL- '+GLOB.PL+' player- '+player);
			if (GLOB.PL==player) {
			GLOB.GL1=num;
	 //     trace("objclisck num="+num+" x= "+x+" GL1= "+GLOB.GL1);
			 
			 graphics.clear();
		     graphics.lineStyle(2,0x00FFAF);
		//     graphics.beginFill(0x00FF00);
		     graphics.drawCircle( 0,0,Rad+4 );
			 
			 graphics.lineStyle(1,0x000000);
		     graphics.beginFill(col);
		     graphics.drawCircle( 0,0,Rad ); }
	 }
	 
	  private function obrup(evt:MouseEvent):void
	 {
		 GLOB.GL2=num;
		//txt.text="hi";
		//trace("objup Gl2 - ",GLOB.GL2);
		//if GLOB1
		//pow=pow+GLOB.UP1;
		// txt.text="objup "+pow;
	 }
	 
	
	 
	}//class
	
}